package com.jflm.controller.api;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jflm.base.BaseAction;
import com.jflm.domain.Constant;
import com.jflm.domain.ZxExternalDataEntity;
import com.jflm.service.ExternalService;

/**
 * ******************  类说明  *********************
 * class       :  ExternalAction
 * @author     :  mengxiangdong
 * @version    :  1.0  
 * description :   外部数据
 * @see        :                        
 * ***********************************************
 */
@RestController
@RequestMapping("/api/external")
public class ExternalAction extends BaseAction {

	private static final Logger LOG = LoggerFactory.getLogger(ExternalAction.class);
	
	@Autowired
	private ExternalService externalService;

	/**
	 * ********************************************
	 * method name   : findList 
	 * description   : 外部数据
	 * @return       : 
	 * @param        : @param ZxExternalDataEntity
	 * @param        : @return
	 * @param        : @throws Exception
	 * modified      : mengxiangdong ,  2017-10-11  下午2:05:29
	 * @see          : 
	 * *******************************************
	 */
	@RequestMapping(value = "/findList", method = RequestMethod.POST)
	public Map<String, Object> findList(@RequestBody ZxExternalDataEntity zxExternalDataEntity)
			throws Exception {
		Map<String, Object> map = new HashMap<String, Object>();
		Page<ZxExternalDataEntity> page =null;
		 page = PageHelper.startPage(zxExternalDataEntity.getPage(), zxExternalDataEntity.getRows());
	     List<ZxExternalDataEntity>	list = externalService.findList(zxExternalDataEntity);
		map.put(Constant.PAGE_ROWS, list);
		map.put(Constant.PAGE_TOTAL, page.getTotal());
		return map;
	}

}
